﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------


// this will include all needed files to be able to build a Request
include_once($CONF["STUBS_FOLDER"]."Map24MapletRemoteControl/Map24MapletRemoteControl.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


// coordinates of the label to add
$longitude 	= "799.04816";
$latitude 	= "3150.0925";

//Text (array)
$text=array("Berlin","Kurfürstendamm");

// symbol used 	to display the label
$symbolId	= "3";

// zoomlevel
$mapViewClippingWidth = 1000;

// Anchor
$Anchor = "CENTER";

//BackgroundColor
$BgrdColor['red']='150';
$BgrdColor['green']='150';
$BgrdColor['blue']='0';
$BgrdColor['alpha']='150';

//FrameColor
$FrameColor['red']='0';
$FrameColor['green']='255';
$FrameColor['blue']='0';
$FrameColor['alpha']='100';

//InscriptionColor
$InscriptionColor['red']='0';
$InscriptionColor['green']='0';
$InscriptionColor['blue']='255';
$InscriptionColor['alpha']='255';


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// here are all commands defined and are put together in one ArrayOfCommands

// this object will add a new label
$cmdIdx=0;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Label = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Label->MapObjectID = "label";
$commands[$cmdIdx]->DeclareMap24Label->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Label->Coordinate->Longitude = $longitude;
$commands[$cmdIdx]->DeclareMap24Label->Coordinate->Latitude = $latitude;
$commands[$cmdIdx]->DeclareMap24Label->Text = $text;
$commands[$cmdIdx]->DeclareMap24Label->Anchor=new Anchor();
$commands[$cmdIdx]->DeclareMap24Label->Anchor=$Anchor;
$commands[$cmdIdx]->DeclareMap24Label->BgrdColor = new Color();
$commands[$cmdIdx]->DeclareMap24Label->BgrdColor->red=$BgrdColor['red'];
$commands[$cmdIdx]->DeclareMap24Label->BgrdColor->green=$BgrdColor['green'];
$commands[$cmdIdx]->DeclareMap24Label->BgrdColor->blue=$BgrdColor['blue'];
$commands[$cmdIdx]->DeclareMap24Label->BgrdColor->alpha=$BgrdColor['alpha'];
$commands[$cmdIdx]->DeclareMap24Label->FrameColor = new Color();
$commands[$cmdIdx]->DeclareMap24Label->FrameColor->red=$FrameColor['red'];
$commands[$cmdIdx]->DeclareMap24Label->FrameColor->green=$FrameColor['green'];
$commands[$cmdIdx]->DeclareMap24Label->FrameColor->blue=$FrameColor['blue'];
$commands[$cmdIdx]->DeclareMap24Label->FrameColor->alpha=$FrameColor['alpha'];
$commands[$cmdIdx]->DeclareMap24Label->InscriptionColor = new Color();
$commands[$cmdIdx]->DeclareMap24Label->InscriptionColor->red=$InscriptionColor['red'];
$commands[$cmdIdx]->DeclareMap24Label->InscriptionColor->green=$InscriptionColor['green'];
$commands[$cmdIdx]->DeclareMap24Label->InscriptionColor->blue=$InscriptionColor['blue'];
$commands[$cmdIdx]->DeclareMap24Label->InscriptionColor->alpha=$InscriptionColor['alpha'];
$commands[$cmdIdx]->DeclareMap24Label->XOffset=1;
$commands[$cmdIdx]->DeclareMap24Label->YOffset=1;
$commands[$cmdIdx]->DeclareMap24Label->SymbolID = $symbolId;

// this object will enable the new label on the map
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->ControlMapObject = new ControlMapObject();
$commands[$cmdIdx]->ControlMapObject->Control = "ENABLE";
$commands[$cmdIdx]->ControlMapObject->MapObjectIDs = array("label");

// this object will center the map above the new label
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->SetMapView = new SetMapView();
$commands[$cmdIdx]->SetMapView->MapObjectIDs = array("label");
$commands[$cmdIdx]->SetMapView->ClippingWidth = new SetMapViewClippingWidth();
$commands[$cmdIdx]->SetMapView->ClippingWidth->MinimumWidth = $mapViewClippingWidth;


// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new MapletRemoteControlRequest();
$request->Map24MRC = new Map24MRC();
$request->Map24MRC->Commands = $commands;


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------


// in this object the SoapClient will be initiated and executed
$mrc = new Map24MapletRemoteControl($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $mrc->mapletRemoteControl($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


$resultString = "This command generates no output";
$counter = 0;
?>